{
  Ivanov Nikita
  4/12/2012
  Rectangles
}
program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  Rectangle= class
    public
    a:integer;
    b:integer;
    s:integer;
    procedure square;
    procedure update(newa, newb: integer); virtual;
    constructor Create;
  end;

  SmartRectangle= class(Rectangle)
    s:integer;
    procedure update(newa, newb: integer); override;
  end;
{ Rectangle }

constructor Rectangle.Create;
begin
 readln(a);
 readln(b);
end;

procedure Rectangle.square;
begin
  if (a<>0) and (b<>0) then
  writeln('Square is: ', a*b)
  else
  writeln('U mad?');
end;

procedure Rectangle.update(newa, newb: integer);
begin
  a:=newa;
  b:=newb;
end;

procedure SmartRectangle.update(newa, newb: integer);
begin
  a:=newa;
  b:=newb;
  if (a<>0) and (b<>0) then
   s:= a*b
  else
    writeln('U mad?');
end;


var
  r1: Rectangle;
  r2: SmartRectangle;
begin
  r1:= Rectangle.Create;
// Some code here

  r2:= SmartRectangle.Create;
// Some code here
end.
